/**
 * Candidate number: 35834
 */
package tv.starfu.systems.level;

import com.artemis.ComponentMapper;
import com.artemis.Entity;
import com.artemis.EntityProcessingSystem;
import tv.starfu.components.level.KyberneteGrid;

/**
 * Only processes KyberneteGrid. Process *before* TileSystem.
 * AnimaSpatial might not be needed.
 * @author nia radical
 */
public class TrackGeneratorSystem extends EntityProcessingSystem {
    // TODO check out intervalprocessingsystem
    
    private KyberneteGrid kyberGrid;
    private ComponentMapper<KyberneteGrid> kyberGridMapper;
    
    public TrackGeneratorSystem(KyberneteGrid k) {
        super(KyberneteGrid.class);
        kyberGrid = k;
    }
    
    @Override
    public void initialize() {
        kyberGridMapper = new ComponentMapper<KyberneteGrid>(KyberneteGrid.class, world);
        System.out.println("TrackGeneratorSystem: Kybernete Agent initialise");
        
    }
    
    /**
     * Run thru grid, create new tile entity for each compass
     * @param e 
     */
    @Override
    protected void process(Entity e) {
        //System.out.println("TrackGeneratorSystem: Grid is an entity");
      //  System.out.println("KyberneteGrid have fun?" + kyberGrid.length);
        // Run through the grid
//        for(int x = 0; x < kyberGrid.width; ++x) {
//            for(int y = 0; y < kyberGrid.length; ++y) {
//                System.out.println("Kybernete Agent" +x +y);
//               // Create new tile entity with current position and compass points
//                if(kyberGrid.grid[x][y] == null) {
//                Entity newTile = EntityFactory.createKyberTile(world, x, y, kyberGrid.grid[x][y]);
//                newTile.refresh();
//                }
//            }
//        }
    }
    
}
